package api

import (
	"fanqiechaodan-blog/common"
	"fanqiechaodan-blog/service"
	"net/http"
)

func (*Api) Login(writer http.ResponseWriter, request *http.Request) {
	params := common.GetRequestJSONParam(request)
	userName := params["username"].(string)
	passwd := params["passwd"].(string)
	res, err := service.Login(userName, passwd)
	if err != nil {
		common.Error(writer, err)
		return
	}
	common.Success(writer, res)
}
